public class Solution409 {
    public int longestPalindrome(String s) {
        int[] f=new int[100];
        for (char c : s.toCharArray()) {
            f[c-'A']++;
        }
        int ans=0;
        int flag=0;
        for (int i = 0; i < 100; i++) {
            if (f[i]%2==1){
                ans+=f[i]-1;
                flag=1;
            }else{
                ans+=f[i];
            }
        }
        return ans+flag;
    }

    public static void main(String[] args) {
        System.out.println(new Solution409().longestPalindrome("abccccdd"));
    }
}
